using System;
using NUnit.Framework;
using ValidationFramework.Reflection;
using Rhino.Mocks;

namespace ValidationFramework.Tests.Reflection
{
	[TestFixture]
	public class RuleCollectionTest
	{
		public class TestClass
		{
			[IncludeMember]
			public string Property
			{
				get;
				set;
			}
		}

		[Test]
		public void Constructor_Simple()
		{
			var typeHandle = typeof(TestClass).TypeHandle;
			var ruleCollection = new RuleCollection(typeHandle);
			Assert.IsTrue(ruleCollection.Count == 0);
		}

		[Test]
		[ExpectedException(typeof(ArgumentNullException))]
		public void SetItem_Should_Throw_When_Adding_Null_Rule()
		{
			var typeHandle = typeof(TestClass).TypeHandle;
			var ruleCollection = new RuleCollection(typeHandle);
			ruleCollection.Add(null);
		}

	}
}